<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/8/31 0031
  Time: 18:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
  <base href="<%=basePath%>">
  <meta charset="utf-8"/>
  <title></title>
  <link rel="stylesheet" type="text/css" href="easyui-1.3.6/themes/default/easyui.css">
  <link rel="stylesheet" type="text/css" href="easyui-1.3.6/themes/icon.css">
  <link rel="stylesheet" type="text/css" href="easyui-1.3.6/demo/demo.css">
  <script type="text/javascript" src="easyui-1.3.6/jquery.min.js"></script>
  <script type="text/javascript" src="easyui-1.3.6/jquery.easyui.min.js"></script>
</head>
<body>
<div class="row">
  <div class="col-md-12">
    <!-- BEGIN PAGE TITLE & BREADCRUMB-->
    <h3 class="page-title" id="index-page-title" style="font: normal 30px/0.8em '微软雅黑'">孜点教科</h3>
    <ul class="page-breadcrumb breadcrumb">
      <%--<li>
        <i class="fa fa-home"></i>
        首页
        <i class="fa fa-angle-right"></i>
      </li>--%>
      <li>
        老师管理
        <i class="fa fa-angle-right"></i>
      </li>
      <li>
        <%--<a href="javascript:;">--%>
        添加老师
        <%--</a>--%>
      </li>
    </ul>
    <!-- END PAGE TITLE & BREADCRUMB-->
  </div>
</div>
<div style="margin:20px 0;"></div>
<div style="width:500px; margin:auto">
<div class="easyui-panel" title="请按规定填写数据添加一个老师" style="width:500px;margin: auto">
  <div style="padding:10px 60px 20px 60px">
    <form id="ff" class="easyui-form" method="post" data-options="novalidate:true">
      <table style="margin:0px auto;margin-top:15px;">
        <tr>
          <td style="display:inline-block;letter-spacing:3px;height:30px;line-height:30px;width: 70px;">教师工号:</td>
          <td><input class="easyui-validatebox" name="teacherId"
                     data-options="validType:'text',required:true,missingMessage:'不能为空！',validType:'length[1,20]',invalidMessage:'长度请不要大于20'" style="width:300px;height:30px; border:1px solid #d6dde5;background-color:transparent;padding:0px 10px;margin-bottom: 10px;"></td>
        </tr>
        <tr>
          <td style="display:inline-block;letter-spacing:3px;height:30px;line-height:30px;width: 70px;">教师名字:</td>
          <td><input class="easyui-validatebox" name="teacherName"
                     data-options="validType:'text',required:true,missingMessage:'不能为空！',validType:'length[1,20]',invalidMessage:'长度请不要大于20'" style="width:300px;height:30px; border:1px solid #d6dde5;background-color:transparent;padding:0px 10px;margin-bottom: 10px;"></td>
        </tr>
        <tr>
          <td style="letter-spacing:3px;">教师性别:</td>
          <td ><select class="easyui-combobox" name="teacherSex" style="display:inline-block;float: left;width:300px;height:30px; border:1px solid #d6dde5;background-color:transparent;margin-bottom: 10px !important;">
            <option value="男">男</option>
            <option value="女">女</option>
          </select></td>
        </tr>
        <tr>
          <td style="display:inline-block;letter-spacing:3px;height:30px;line-height:30px;width: 70px;padding-top: 10px;">教师职称:</td>
          <td><input class="easyui-validatebox" name="teacherPosition"
                     data-options="validType:'text',required:true,missingMessage:'不能为空！',validType:'length[1,20]',invalidMessage:'长度请不要大于20'" style="width:300px;height:30px; border:1px solid #d6dde5;background-color:transparent;padding:0px 10px;margin:10px 0px;"></td>
        </tr>
        <tr>
          <td style="display:inline-block;letter-spacing:3px;height:30px;line-height:30px;width: 70px;">教师电话:</td>
          <td><input class="easyui-validatebox" name="teacherPhoneNumber"
                     data-options="validType:'mobile',required:true,missingMessage:'不能为空！'" style="width:300px;height:30px; border:1px solid #d6dde5;background-color:transparent;padding:0px 10px;margin-bottom: 10px;"></td>
        </tr>
        <tr>
          <td style="display:inline-block;height:30px;line-height:30px;width: 70px;">教师身份证:</td>
          <td><input class="easyui-validatebox" name="teacherIdCard"
                     data-options="validType:'text',required:true,missingMessage:'不能为空！',validType:'idCode',invalidMessage:'身份证格式不正确'" style="width:300px;height:30px; border:1px solid #d6dde5;background-color:transparent;padding:0px 10px;margin-bottom: 10px;"></td>
        </tr>
        <tr>
          <td style="display:inline-block;letter-spacing:3px;height:30px;line-height:30px;width: 70px;" >教师学院:</td>
          <td><input class="easyui-validatebox" name="teacherCollege"
                     data-options="validType:'text',required:true,missingMessage:'不能为空！',validType:'length[1,20]',invalidMessage:'长度请不要大于20'" style="width:300px;height:30px; border:1px solid #d6dde5;background-color:transparent;padding:0px 10px;margin-bottom: 10px;"></td>
        </tr>
        <tr>
          <td style="display:inline-block;letter-spacing:3px;height:30px;line-height:30px;width: 70px;">教师学校:</td>
          <td><input class="easyui-validatebox" name="teacherSchool"
                     data-options="validType:'text',required:true,missingMessage:'不能为空！',validType:'length[1,20]',invalidMessage:'长度请不要大于20'" style="width:300px;height:30px; border:1px solid #d6dde5;background-color:transparent;padding:0px 10px;margin-bottom: 10px;"></td>
        </tr>
      </table>
      <input type="hidden" value="${user.teacherid }" name="manageId">
    </form>
    <div style="text-align:center;padding:5px">
      <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:114px;height:30px;">提交</a>
      <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()" style="width:114px;height:30px;">清除</a>
    </div>
  </div>
</div>
</div>

</body>
<script>
  $.extend($.fn.validatebox.defaults.rules, {
    CHS: {
      validator: function (value, param) {
        return /^[\u0391-\uFFE5]+$/.test(value);
      },
      message: '请输入汉字'
    },
    mobile: {
      validator: function (value, param) {
        return /^(?:13\d|15\d|18\d)-?\d{5}(\d{3}|\*{3})$/.test(value);
      },
      message: '手机号码不正确'
    },
    idCode:{
      validator:function(value,param){
        return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(value);
      },
      message: '格式不正确'
    }
  });

  function submitForm() {
    $('#ff').form('submit', {
      url : 'rest/page/manageTea/addTea',
      onSubmit: function () {
        return $(this).form('enableValidation').form('validate');
      },
      success : function(data){
        var obj = JSON.parse(data)
        if(obj.code == 200){
          $.messager.show({title:'操作提示',msg:obj.message,showType:'show',style: {
            top:($(window).height()-200) * 0.5,
            left:($(window).width() -250) * 0.5
          }});
        }else{
          $.messager.show({title:'操作提示',msg:obj.message,showType:'show',style: {
            top:($(window).height()-200) * 0.5,
            left:($(window).width() -250) * 0.5
          }});
        }
      }
    });
  }
  function clearForm() {
    $('#ff').form('clear');
  }


</script>
</html>
